import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:namewava/jc_rote_path.dart';
import 'package:namewava/pages/calendar/widgets/jc_calender_pop.dart';
import 'package:namewava/utils/jc_image_path.dart';
import 'package:namewava/utils/jc_screenutil_info.dart';

class JcCalendarHead extends StatelessWidget {
  const JcCalendarHead(
      {super.key,
      required this.userUrl,
      required this.record,
      required this.sureTap, required this.isFirstRegister});
  final String userUrl;
   final bool isFirstRegister;
  final List record;
  final Function sureTap;

  @override
  Widget build(BuildContext context) {
    return Container(
      //padding: EdgeInsets.symmetric(horizontal: 24.w),
      padding: EdgeInsets.only(
          left: 30.w, right: 30.w, top: JcScreenutilInfo.statusBarHeight),
      // color: Colors.red,
      height: JcScreenutilInfo.statusBarHeight + 64,
      // color: Colors.yellow,
      child: Row(
        crossAxisAlignment: CrossAxisAlignment.center,
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [
          GestureDetector(
            child: Container(
              width: 36.w,
              height: 36.w,
              alignment: Alignment.center,
              decoration: BoxDecoration(
                  border: Border.all(width: 1, color: Colors.white),
                  borderRadius: BorderRadius.circular(18.w)),
              child: Container(
                height: 34.w,
                width: 34.w,
                decoration:
                    BoxDecoration(borderRadius: BorderRadius.circular(17.w)),
                child: ClipRRect(
                  borderRadius: BorderRadius.circular(17.w),
                  child: isFirstRegister?Image.asset(JcImagePath.jcWavaDfuHeadIcon,width: double.infinity,height: double.infinity,fit: BoxFit.fill,):
                  userUrl == ''
                      ? const Text('')
                      : FadeInImage.assetNetwork(
                          placeholder: JcImagePath.jcWavaDhead,
                          image: userUrl,
                          width: double.infinity,
                          height: double.infinity,
                        ),
                ),
              ),
            ),
            onTap: () {
              Get.toNamed(JcRotePath.jcMineInfo);
            },
          ),
          GestureDetector(
            child: Image.asset(JcImagePath.jcWavaBwlRili),
            onTap: () {
              Get.dialog(
                  JcCalenderPop(
                    recordTimes: record,
                    dismissTap: sureTap,
                  ),
                  useSafeArea: false);
            },
          )
        ],
      ),
    );
  }
}
